老白故事[听].js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. var charStr = 'abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789';
  2. function rand(min, max) {
  3. return Math.floor(Math.random() * (max - min + 1)) + min;
  4. }
  5. function randStr(len, withNum, onlyNum) {
  6. var _str = '';
  7. let containsNum = withNum === undefined ? true : withNum;
  8. for (var i = 0; i < len; i++) {
  9. let idx = onlyNum ? rand(charStr.length - 10, charStr.length - 1) : rand(0, containsNum ? charStr.length - 1 : charStr.length - 11);
  10. _str += charStr[idx];
  11. }
  12. return _str;
  13. }
  14. function randUUID() {
  15. return randStr(8).toLowerCase() + '-' + randStr(4).toLowerCase() + '-' + randStr(4).toLowerCase() + '-' + randStr(4).toLowerCase() + '-' + randStr(12).toLowerCase();
  16. }
  17. function randMAC() {
  18. return randStr(2).toUpperCase() + ':' + randStr(2).toUpperCase() + ':' + randStr(2).toUpperCase() + ':' + randStr(2).toUpperCase() + ':' + randStr(2).toUpperCase() + ':' + randStr(2).toUpperCase();
  19. }
  20. const deviceBrands = ['Huawei', 'Xiaomi'];
  21. const deviceModels = [
  22. ['MHA-AL00', 'HUAWEI Mate 9', 'MHA-TL00', 'HUAWEI Mate 9', 'LON-AL00', 'HUAWEI Mate 9 Pro', 'ALP-AL00', 'HUAWEI Mate 10', 'ALP-TL00', 'HUAWEI Mate 10', 'BLA-AL00', 'HUAWEI Mate 10 Pro', 'BLA-TL00', 'HUAWEI Mate 10 Pro', 'HMA-AL00', 'HUAWEI Mate 20', 'HMA-TL00', 'HUAWEI Mate 20', 'LYA-AL00', 'HUAWEI Mate 20 Pro', 'LYA-AL10', 'HUAWEI Mate 20 Pro', 'LYA-TL00', 'HUAWEI Mate 20 Pro', 'EVR-AL00', 'HUAWEI Mate 20 X', 'EVR-TL00', 'HUAWEI Mate 20 X', 'EVR-AN00', 'HUAWEI Mate 20 X', 'TAS-AL00', 'HUAWEI Mate 30', 'TAS-TL00', 'HUAWEI Mate 30', 'TAS-AN00', 'HUAWEI Mate 30', 'TAS-TN00', 'HUAWEI Mate 30', 'LIO-AL00', 'HUAWEI Mate 30 Pro', 'LIO-TL00', 'HUAWEI Mate 30 Pro', 'LIO-AN00', 'HUAWEI Mate 30 Pro', 'LIO-TN00', 'HUAWEI Mate 30 Pro', 'LIO-AN00m', 'HUAWEI Mate 30E Pro', 'OCE-AN10', 'HUAWEI Mate 40', 'OCE-AN50', 'HUAWEI Mate 40E', 'OCE-AL50', 'HUAWEI Mate 40E', 'NOH-AN00', 'HUAWEI Mate 40 Pro', 'NOH-AN01', 'HUAWEI Mate 40 Pro', 'NOH-AL00', 'HUAWEI Mate 40 Pro', 'NOH-AL10', 'HUAWEI Mate 40 Pro', 'NOH-AN50', 'HUAWEI Mate 40E Pro', 'NOP-AN00', 'HUAWEI Mate 40 Pro', 'CET-AL00', 'HUAWEI Mate 50', 'CET-AL60', 'HUAWEI Mate 50E', 'DCO-AL00', 'HUAWEI Mate 50 Pro', 'TAH-AN00', 'HUAWEI Mate X', 'TAH-AN00m', 'HUAWEI Mate Xs', 'TET-AN00', 'HUAWEI Mate X2', 'TET-AN10', 'HUAWEI Mate X2', 'TET-AN50', 'HUAWEI Mate X2', 'TET-AL00', 'HUAWEI Mate X2', 'PAL-AL00', 'HUAWEI Mate Xs 2', 'PAL-AL10', 'HUAWEI Mate Xs 2', 'EVA-AL00', 'HUAWEI P9', 'EVA-AL10', 'HUAWEI P9', 'EVA-TL00', 'HUAWEI P9', 'EVA-DL00', 'HUAWEI P9', 'EVA-CL00', 'HUAWEI P9', 'VIE-AL10', 'HUAWEI P9 Plus', 'VTR-AL00', 'HUAWEI P10', 'VTR-TL00', 'HUAWEI P10', 'VKY-AL00', 'HUAWEI P10 Plus', 'VKY-TL00', 'HUAWEI P10 Plus', 'EML-AL00', 'HUAWEI P20', 'EML-TL00', 'HUAWEI P20', 'CLT-AL00', 'HUAWEI P20 Pro', 'CLT-AL01', 'HUAWEI P20 Pro', 'CLT-AL00l', 'HUAWEI P20 Pro', 'CLT-TL00', 'HUAWEI P20 Pro', 'CLT-TL01', 'HUAWEI P20 Pro', 'ELE-AL00', 'HUAWEI P30', 'ELE-TL00', 'HUAWEI P30', 'VOG-AL00', 'HUAWEI P30 Pro', 'VOG-AL10', 'HUAWEI P30 Pro', 'VOG-TL00', 'HUAWEI P30 Pro', 'ANA-AL00', 'HUAWEI P40', 'ANA-AN00', 'HUAWEI P40', 'ANA-TN00', 'HUAWEI P40', 'ELS-AN00', 'HUAWEI P40 Pro', 'ELS-TN00', 'HUAWEI P40 Pro', 'ELS-AN10', 'HUAWEI P40 Pro', 'ELS-TN10', 'HUAWEI P40 Pro', 'ABR-AL00', 'HUAWEI P50', 'ABR-AL80', 'HUAWEI P50', 'ABR-AL60', 'HUAWEI P50E', 'ABR-AL90', 'HUAWEI P50E', 'JAD-AL00', 'HUAWEI P50 Pro', 'JAD-AL80', 'HUAWEI P50 Pro', 'JAD-AL50', 'HUAWEI P50 Pro', 'JAD-AL60', 'HUAWEI P50 Pro', 'BAL-AL00', 'HUAWEI P50 Pocket', 'BAL-AL60', 'HUAWEI Pocket S', 'PIC-AL00', 'HUAWEI nova 2', 'PIC-TL00', 'HUAWEI nova 2', 'BAC-AL00', 'HUAWEI nova 2 Plus', 'BAC-TL00', 'HUAWEI nova 2 Plus', 'HWI-AL00', 'HUAWEI nova 2s', 'HWI-TL00', 'HUAWEI nova 2s', 'ANE-AL00', 'HUAWEI nova 3e', 'ANE-TL00', 'HUAWEI nova 3e', 'PAR-AL00', 'HUAWEI nova 3', 'PAR-TL00', 'HUAWEI nova 3', 'INE-AL00', 'HUAWEI nova 3i', 'INE-TL00', 'HUAWEI nova 3i', 'VCE-AL00', 'HUAWEI nova 4', 'VCE-TL00', 'HUAWEI nova 4', 'MAR-AL00', 'HUAWEI nova 4e', 'MAR-TL00', 'HUAWEI nova 4e', 'SEA-AL00', 'HUAWEI nova 5', 'SEA-TL00', 'HUAWEI nova 5', 'SEA-AL10', 'HUAWEI nova 5 Pro', 'SEA-TL10', 'HUAWEI nova 5 Pro', 'GLK-AL00', 'HUAWEI nova 5i', 'GLK-TL00', 'HUAWEI nova 5i', 'GLK-LX1U', 'HUAWEI nova 5i', 'SPN-TL00', 'HUAWEI nova 5i Pro', 'SPN-AL00', 'HUAWEI nova 5z', 'WLZ-AL10', 'HUAWEI nova 6', 'WLZ-AN00', 'HUAWEI nova 6', 'JNY-AL10', 'HUAWEI nova 6 SE', 'JNY-TL10', 'HUAWEI nova 6 SE', 'JEF-AN00', 'HUAWEI nova 7', 'JEF-AN20', 'HUAWEI nova 7', 'JEF-TN00', 'HUAWEI nova 7', 'JEF-TN20', 'HUAWEI nova 7', 'JER-AN10', 'HUAWEI nova 7 Pro', 'JER-AN20', 'HUAWEI nova 7 Pro', 'JER-TN10', 'HUAWEI nova 7 Pro', 'JER-TN20', 'HUAWEI nova 7 Pro', 'CDY-AN00', 'HUAWEI nova 7 SE', 'CDY-AN20', 'HUAWEI nova 7 SE', 'CDY-TN00', 'HUAWEI nova 7 SE', 'CDY-TN20', 'HUAWEI nova 7 SE', 'ANG-AN00', 'HUAWEI nova 8', 'BRQ-AN00', 'HUAWEI nova 8 Pro', 'BRQ-AL00', 'HUAWEI nova 8 Pro', 'JSC-AN00', 'HUAWEI nova 8 SE', 'JSC-TN00', 'HUAWEI nova 8 SE', 'JSC-AL50', 'HUAWEI nova 8 SE', 'NAM-AL00', 'HUAWEI nova 9', 'RTE-AL00', 'HUAWEI nova 9 Pro', 'JLN-AL00', 'HUAWEI nova 9 SE', 'NCO-AL00', 'HUAWEI nova 10', 'GLA-AL00', 'HUAWEI nova 10 Pro', 'CHA-AL80', 'HUAWEI nova 10z'],
  23. ['M2001J2C', 'Xiaomi 10', 'M2001J2G', 'Xiaomi 10', 'M2001J2I', 'Xiaomi 10', 'M2011K2C', 'Xiaomi 11', 'M2011K2G', 'Xiaomi 11', '2201123C', 'Xiaomi 12', '2201123G', 'Xiaomi 12', '2112123AC', 'Xiaomi 12X', '2112123AG', 'Xiaomi 12X', '2201122C', 'Xiaomi 12 Pro', '2201122G', 'Xiaomi 12 Pro'],
  24. ];
  25. function randDevice() {
  26. let brandIdx = rand(0, deviceBrands.length - 1);
  27. let brand = deviceBrands[brandIdx];
  28. let modelIdx = rand(0, deviceModels[brandIdx].length / 2 - 1);
  29. let model = deviceModels[brandIdx][modelIdx * 2 + 1];
  30. let release = rand(8, 13);
  31. let buildId = randStr(3, false).toUpperCase() + rand(11, 99) + randStr(1, false).toUpperCase();
  32. return {
  33. brand: brand,
  34. model: model,
  35. release: release,
  36. buildId: buildId,
  37. };
  38. }
  39. function randDeviceWithId(len) {
  40. let device = randDevice();
  41. device['id'] = randStr(len);
  42. return device;
  43. }
  44. function formatPlayUrl(src, name) {
  45. if (src.trim() == name.trim()) {
  46. return name;
  47. }
  48. return name
  49. .trim()
  50. .replaceAll(src, '')
  51. .replace(/<|>|《|》/g, '')
  52. .replace(/\$|#/g, ' ')
  53. .trim();
  54. }
  55. globalThis.randDeviceWithId = randDeviceWithId;
  56. globalThis.formatPlayUrl = formatPlayUrl;
  57. globalThis.appVersion = '1.1.7';
  58. globalThis.appUA = '';
  59. globalThis.appData = {};
  60. globalThis.device = {};
  61. globalThis.nativeEncode = '1449682949';
  62. globalThis.pk = NODERSA.NodeRSA(
  63. `-----BEGIN PUBLIC KEY-----
  64. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtSwotbu7UEonUCzCsJXP
  65. SpYOrkuMnpyk24PBQskkcwYZsUTwbh8Y9vHuPIerh3AfZZ1luFV9yPC282xiNX+/
  66. +IAzWHWG6M+dWmJnDyybeUVTh7H7YVM31eSR9TFT4VASr7NftgCv7hfS2mVNL0sx
  67. RrMSPSXa6SbjkIeW4GTpYpWKehKfaqrgDwVfFCu67ogL9JLIdDxvWthIe42uUMnz
  68. 4II1/pdrPtWRu0CDjaxvsLz26UdMGSL3gFEloaJhp4KuIPK4RlIx+9t28H00+3Ip
  69. eVirmiayDYJQe1cjiDKoERSkLubJRD2yj5X3trGmgXex3QkcRtx5UNXYkLEuEMNG
  70. iwIDAQAB
  71. -----END PUBLIC KEY-----`,
  72. 'pkcs8-public-pem',
  73. {
  74. encryptionScheme: 'pkcs1',
  75. },
  76. );
  77. globalThis.imgUrl = function (pic) {
  78. if (pic.startsWith('http')) return pic;
  79. return appData.img_url + pic;
  80. }
  81. var rule = {
  82. 类型: '听书',//影视|听书|漫画|小说
  83. title: '老白故事[听]',
  84. host: 'https://lags.oss-cn-hangzhou.aliyuncs.com/',
  85. url: '',
  86. searchUrl: '#fypage',
  87. searchable: 2,
  88. quickSearch: 0,
  89. filterable: 1,
  90. filter: '',
  91. filter_url: '',
  92. headers: {
  93. 'User-Agent': 'MOBILE_UA',
  94. },
  95. timeout: 5000,
  96. play_parse: true,
  97. 预处理: $js.toString(() => {
  98. device = getItem('device', '{}');
  99. if (typeof device == "string") {
  100. device = JSON.parse(device);
  101. }
  102. // device = JSON.parse(device);
  103. if (!device.id) {
  104. device = randDeviceWithId(32);
  105. device.id = device.id.toLowerCase();
  106. device.ua = 'Dalvik/2.1.0 (Linux; U; Android ' + device.release + '; ' + device.model + ' Build/' + device.buildId + ')';
  107. setItem('device', JSON.stringify(device))
  108. }
  109. // log('device:');
  110. // log(device);
  111. appUA = '(Mozilla/5.0 (Linux; Android ' + device.release + '; ' + device.model + ' Build/' + device.buildId + '; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.70 Mobile Safari/537.36)';
  112. try {
  113. let html = request(rule.host + '/' + appVersion + '.json');
  114. let content = JSON.parse(html);
  115. // log(content.data);
  116. var datas = content.data.split('$6c1cef78ae=');
  117. var json = '';
  118. for (let d of datas) {
  119. // json += pk.decryptPublic(d, 'utf8').replace(/^\s*\n|\s*$/gm, '');
  120. json += pk.decryptPublic(d, 'utf8');
  121. }
  122. appData = JSON.parse(json);
  123. // log(appData);
  124. appUA = appData.ua + '/' + appVersion + appUA;
  125. log('appUA:' + appUA);
  126. } catch (error) {
  127. console.log(error);
  128. }
  129. rule.headers = {
  130. 'User-Agent': appUA,
  131. Referer: appData.http_referer,
  132. }
  133. }),
  134. class_parse: $js.toString(() => {
  135. let html = request(appData.json_url + 'cat/index.json', {
  136. headers: rule.headers
  137. });
  138. let content = JSON.parse(html);
  139. let datas = content.data;
  140. let classes = [];
  141. let filterObj = {};
  142. for (let data of datas) {
  143. let name = data.title.replace('分类', '');
  144. let type = {
  145. key: 'type',
  146. name: '类型',
  147. };
  148. var cvalues = data.types.reduce((result, t) => {
  149. result.push({n: t.name, v: t.type_id});
  150. return result;
  151. }, []);
  152. type['init'] = cvalues[0]['v'];
  153. type['value'] = cvalues;
  154. let sort = {
  155. key: 'sort',
  156. name: '排序',
  157. init: 'hot',
  158. };
  159. let sortValues = [];
  160. sortValues.push({n: '默认', v: 'index'});
  161. sortValues.push({n: '热门', v: 'hot'});
  162. sortValues.push({n: '连载', v: 'serial'});
  163. sortValues.push({n: '完结', v: 'done'});
  164. sort['value'] = sortValues;
  165. filterObj[type['init']] = [type, sort];
  166. classes.push({
  167. type_id: type['init'],
  168. type_name: name,
  169. });
  170. }
  171. // log(classes);
  172. input = classes;
  173. homeObj.filter = filterObj;
  174. }),
  175. 推荐: '',
  176. 一级: $js.toString(() => {
  177. VODS = [];
  178. let type = MY_FL.type || MY_CATE;
  179. let sort = MY_FL.sort || 'hot';
  180. let html = request(appData.json_url + 'cat_list/' + type + '/' + sort + '/' + MY_PAGE + '.json', {headers: rule.headers});
  181. let content = JSON.parse(html);
  182. let datas = content.data;
  183. let books = [];
  184. for (let book of datas.books) {
  185. books.push({
  186. vod_id: book.book_id,
  187. vod_name: book.name,
  188. vod_pic: imgUrl(book.pic),
  189. vod_remarks: book.status,
  190. });
  191. }
  192. VODS = books;
  193. }),
  194. 二级: $js.toString(() => {
  195. let ids = [orId];
  196. let books = [];
  197. for (let id of ids) {
  198. let html = request(appData.json_url + 'cont/' + id + '.json', {headers: rule.headers});
  199. let content = JSON.parse(html);
  200. let data = content.data;
  201. let book = {
  202. vod_name: data.name,
  203. vod_pic: imgUrl(data.pic),
  204. type_name: '',
  205. vod_year: data.time,
  206. vod_area: '',
  207. vod_remarks: data.status,
  208. vod_actor: data.teller,
  209. vod_director: '',
  210. vod_content: data.synopsis,
  211. vod_play_from: '道长在线',
  212. };
  213. // log(book);
  214. let us = data.play_data
  215. .map(function (b) {
  216. return formatPlayUrl(book.vod_name, b.name) + '$' + data.book_id + '-' + b.play_id;
  217. })
  218. .join('#');
  219. book.vod_play_url = us;
  220. books.push(book);
  221. }
  222. VOD = books.length > 0 ? books[0] : {};
  223. }),
  224. 搜索: $js.toString(() => {
  225. let time = Math.floor(new Date().getTime() / 1000);
  226. time = time - (time % 60);
  227. let t = CryptoJS.enc.Hex.stringify(CryptoJS.MD5(CryptoJS.enc.Hex.stringify(CryptoJS.MD5('search00')).toString() + nativeEncode + time)).toString();
  228. let data = {
  229. m: 'search',
  230. t: t,
  231. aid: 0,
  232. pid: 0,
  233. key: KEY,
  234. };
  235. // var params = pk.encrypt(JSON.stringify(data), 'base64').replace(/^\s*\n|\s*$/gm, '');
  236. var params = pk.encrypt(JSON.stringify(data), 'base64');
  237. log('params长度:' + params.length);
  238. let post_obj = {
  239. params: params,
  240. version: appVersion,
  241. };
  242. let post_data = `params=${params}&version=${appVersion}`;
  243. // log('post_data:' + post_data);
  244. log('api_url:' + appData.api_url);
  245. let headers = JSON.parse(JSON.stringify(rule.headers));
  246. // headers['Accept'] = 'application/json, text/plain, */*';
  247. headers['Content-Type'] = 'application/x-www-form-urlencoded';
  248. let html = post(appData.api_url, {
  249. headers: headers,
  250. body: post_data,
  251. });
  252. let content = JSON.parse(html);
  253. var datas = content.data;
  254. let books = [];
  255. for (let book of datas.books) {
  256. books.push({
  257. vod_id: book.book_id,
  258. vod_name: book.name,
  259. vod_pic: imgUrl(book.pic),
  260. vod_remarks: book.status,
  261. });
  262. }
  263. VODS = books;
  264. }),
  265. lazy: $js.toString(() => {
  266. var info = input.split('-');
  267. let time = Math.floor(new Date().getTime() / 1000);
  268. time = time - (time % 60);
  269. let t = CryptoJS.enc.Hex.stringify(CryptoJS.MD5(CryptoJS.enc.Hex.stringify(CryptoJS.MD5('play' + info[0] + info[1])).toString() + nativeEncode + time)).toString();
  270. let data = {
  271. m: 'play',
  272. t: t,
  273. aid: info[0],
  274. pid: info[1],
  275. };
  276. // var params = pk.encrypt(JSON.stringify(data), 'base64').replace(/^\s*\n|\s*$/gm, '');
  277. var params = pk.encrypt(JSON.stringify(data), 'base64');
  278. // log('params:' + params);
  279. // log([params]);
  280. log('params长度:' + params.length);
  281. let post_obj = {
  282. params: params,
  283. version: appVersion,
  284. };
  285. let post_data = buildUrl('', post_obj).slice(1);
  286. // let post_data = `params=${params}&version=${appVersion}`;
  287. // log('post_data:' + post_data);
  288. log('api_url:' + appData.api_url);
  289. let headers = JSON.parse(JSON.stringify(rule.headers));
  290. // headers['Accept'] = 'application/json, text/plain, */*';
  291. headers['Content-Type'] = 'application/x-www-form-urlencoded';
  292. let html = post(appData.api_url, {
  293. headers: headers,
  294. body: post_obj,
  295. postType: "form",
  296. });
  297. let content = JSON.parse(html);
  298. var datas = content.data;
  299. input = {
  300. parse: 0,
  301. url: datas.url,
  302. header: {
  303. 'User-Agent': appUA,
  304. Referer: appData.referer,
  305. },
  306. };
  307. }),
  308. }